<%@ Page Language="C#" AutoEventWireup="true" CodeFile="AgentTypeList.aspx.cs" Inherits="admin_Agent_AgentTypeList" %>
<%@ Register Src="../../Control/PageNo.ascx" TagName="PageNo" TagPrefix="uc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>招商代理分类管理</title>
<link rel="stylesheet" href="../skin/style.css" type="text/css" />
<script type="text/javascript" src="../js/jquery-1.2.5.js"></script>
<script type="text/javascript" src="../../js/jquery.js"></script>
<script type="text/javascript">
function IsNum(obj)
   {
	 var vlu=obj.value.replace(/\D/g,'');
	 if(obj.value!=vlu)
	 {
	  alert("输入的必须都为整数");
	  obj.focus();
	  }
	 return false;
   }
</script>

<script type="text/javascript">

	function SelectAll()
	{
		// 找到所有的 input 元素
		var ctllist = window.document.form1.getElementsByTagName("input");
		var objcheckbox= document.form1.CheckBox2;             
		for( var i = 0; i< ctllist.length; i++)
		{
			if( ctllist[i].type == "checkbox")
			{
				if( ctllist[i].name.indexOf( "CheckBox1") >=0 )
				{   
					if(objcheckbox.checked==true){      
						ctllist[i].checked = true;
					} else{
						ctllist[i].checked = false;
					}
				}
			}           
		 }           
	 }
</script>
</head>
<body>
    <form id="form1" runat="server">
        <div class="itemtitle">
            <h3>
                操作提示</h3>
        </div>
        <div class="itemtitle_tect">
            <ul>
                <li>通过用户管理，您可以进行编辑会员资料、用户组、权限、积分、授权会员勋章以及删除会员等操作；</li>
                <li>请先根据条件搜索用户，然后选择相应的操作。</li>
            </ul>
        </div>
        <asp:Panel ID="pnlIndustryType" runat="server" Visible="False">
            <div class="itemtitle">
                <h3>
                    添加加盟类别</h3>
            </div>
            <div class="itemtitle_tect">
                <p>
                    行业分类名称：
                    <asp:TextBox ID="txtName" runat="server"></asp:TextBox>
                    <asp:DropDownList ID="parentType" runat="server">
                    <asp:ListItem Value="0">无上级分类</asp:ListItem>
                    </asp:DropDownList>
                    <asp:Button ID="btnSave" runat="server" Text="保存" CssClass="i_button" OnClick="btnSave_Click" />
                    <asp:Button ID="btnCancel" runat="server" CssClass="i_button" Text="取消" OnClick="btnCancel_Click" />
                </p>
            </div>
            <div class="clr">
            </div>
        </asp:Panel>
        <div class="clr">
        </div>
        <div class="partition">
            <div class="Option">
                <span><strong>快捷操作</strong></span> <span>
                    <asp:LinkButton ID="ButJS" runat="server" OnClick="ButJS_Click">更新分类</asp:LinkButton></span>
                <span>
                    <asp:LinkButton ID="Lkbtn_AllDelete" runat="server" Text="添加分类" OnClick="Lkbtn_AllDelete_Click"></asp:LinkButton></span>
            </div>
        </div>
        <div class="clr">
        </div>
        <div class="talbe_border">
            <asp:GridView ID="grdAgentType" runat="server" AutoGenerateColumns="False" CellPadding="0"
                GridLines="None" AllowPaging="False" OnPageIndexChanging="grdAgentType_PageIndexChanging"
                OnRowCancelingEdit="grdAgentType_RowCancelingEdit" OnRowEditing="grdAgentType_RowEditing"
                OnRowUpdating="grdAgentType_RowUpdating" DataKeyNames="ID" OnRowDeleting="grdAgentType_RowDeleting"
                CssClass="talbe_list" OnRowCreated="grdAgentType_RowCreated" OnRowDataBound="grdAgentType_RowDataBound">
                <Columns>
                    <asp:TemplateField HeaderText="选中">
                        <ItemTemplate>
                            <asp:CheckBox ID="CheckBox1" runat="server" />
                        </ItemTemplate>
                        <HeaderStyle CssClass="th20 tou" />
                        <ItemStyle CssClass="nolet" />
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="排序">
                        <ItemTemplate>
                            <asp:TextBox ID="txt_Compositor" runat="server" Text='<%# Eval("Compositor") %>'
                                onblur="IsNum(this);" CssClass="i_corp"></asp:TextBox>
                            <asp:Label ID="Lb_id" runat="server" Text='<%#Eval("ID")%>' Visible="false"></asp:Label>
                        </ItemTemplate>
                        <HeaderStyle CssClass="th20i" />
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="分类名称">
                        <ItemTemplate>
                       <%# Eval("Name") %>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:TextBox ID="txtTName" runat="server" Text='<%# Eval("Name") %>'></asp:TextBox>
                        </EditItemTemplate>
                        <ItemStyle CssClass="left2" />
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="上级分类">
                        <ItemTemplate>
                       <%#GetParentType(int.Parse(Eval("ParentID").ToString())) %>
                        </ItemTemplate>
                        <ItemStyle CssClass="left2" />
                    </asp:TemplateField>
                    <asp:CommandField ShowEditButton="True" HeaderText="编辑">
                        <HeaderStyle CssClass="th80" />
                    </asp:CommandField>
                    <asp:TemplateField HeaderText="删除">
                        <ItemTemplate>
                            <asp:LinkButton ID="lbtnUpdate" Text="删除" CommandName="delete" OnClientClick="return confirm('您确认删除该记录吗?');"
                                runat="server"></asp:LinkButton>
                        </ItemTemplate>
                        <HeaderStyle CssClass="th80" />
                    </asp:TemplateField>
                </Columns>
                <HeaderStyle CssClass="header" />
                <AlternatingRowStyle BackColor="White" />
            </asp:GridView>
            <div class="Paging">
                <p>
                    <uc1:PageNo ID="PageNo1" runat="server" />
                </p>
                <input id="CheckBox2" name="CheckBox2" onclick="SelectAll();" type="checkbox" />全选
                <asp:Button ID="btnDelete" runat="server" Font-Size="9pt" OnClick="btnDelete_Click"
                    Text="批量删除" CssClass="i_button" />
                <asp:Label ID="lblMessage" runat="server" Text="Label" Visible="False"></asp:Label>
                <asp:Button ID="LinkButton1" runat="server" Text="排序" OnClick="LinkButton1_Click"
                    CssClass="i_button"></asp:Button>
            </div>
        </div>
    </form>
</body>
</html>
